import QtQuick
import QtQuick.Templates as T
import QtQuick.Controls.impl
import QtQuick.Controls.Fusion
import QtQuick.Controls.Fusion.impl

T.MenuBarItem {
    id: control

    property color hoverColor: "#919293" // 悬停颜色
    property color textColor: "#1a1c1e" // 文本颜色
    property color hoverTextColor: "#ffffff" // 悬停时文本颜色
    property int itemRadius: 4 // 圆角大小

    implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
                            implicitContentWidth + leftPadding + rightPadding)
    implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
                             implicitContentHeight + topPadding + bottomPadding,
                             implicitIndicatorHeight + topPadding + bottomPadding)

    padding: 6
    spacing: 6

    icon.width: 16
    icon.height: 16

    contentItem: IconLabel {
        spacing: control.spacing
        mirrored: control.mirrored
        display: control.display
        alignment: Qt.AlignLeft

        icon: control.icon
        text: control.text
        font: control.font
        color: control.down || control.highlighted ? hoverTextColor : textColor
    }

    background: Rectangle {
        implicitWidth: 20
        implicitHeight: 20

        color: hoverColor
        visible: control.down || control.highlighted
        radius: itemRadius
    }
}
